function jsTable(_deckCount,_minBet,_maxBet,_parentBJ)
{
	jsTable.prototype.m_nMaxPlayers = 6;
	
	this.m_oShoe = new jsShoe(_deckCount);
	this.m_aPlayers = new Array();
	this.m_oObjects = new Object();
	this.m_oParentBJ = _parentBJ;
	this.id = null;
	
	jsTable.prototype.toString = _jsTableToString;
	jsTable.prototype.playerJoin = _jsTableplayerJoin;
	
	jsTable.prototype.preRender = _jsTablepreRender;
	jsTable.prototype.Render = _jsTableRender;
}

function _jsTableToString()
{
	return "Table: " + this.id;
}

function _jsTableplayerJoin()
{
	var player = new jsPlayer("LOL");
	var r = 0;
	if(this.m_bInRound)
	{
		jsDebug.Throw(this,254,"In Round");
	}
	else if(this.m_aPlayers.length<this.m_nMaxPlayers)
	{
		this.m_aPlayers.push(player);
		player.m_szName+=" " + this.m_aPlayers.length;
		jsDebug.Throw(this,254,this.m_aPlayers);
		r=1;
	}else
	{
		
		jsDebug.Throw(this,254,"Max Players on this table");
		r=2;
	}
	this.Render();
	//return status
	return r;
}

function _jsTableRender(parent)
{
	this.preRender(parent);
	this.m_oObjects["playerStatus"].innerHTML = "Players: " + this.m_aPlayers.length + "/" + this.m_nMaxPlayers;
	this.m_oObjects["playerJoinButton"].innerHTML = "Join Table";
	this.m_oObjects["playerJoinButton"].style.display = this.m_aPlayers.length==this.m_nMaxPlayers ? 'none' : 'block';
}

function _jsTablepreRender(parent)
{
	if(this.m_oObjects["container"]==null)
	{
		this.m_oObjects["container"] = document.createElement("div");
		this.m_oObjects["container"].setAttribute("id","dTable" + this.id);
		this.m_oObjects["container"].setAttribute("class","CBJTable");
		if(this.m_oObjects["playerStatus"]==null)
		{
			this.m_oObjects["playerStatus"]= document.createElement("div");
			this.m_oObjects["playerStatus"].setAttribute("id","dTable" + this.id + "_playerStatus");
			this.m_oObjects["playerStatus"].setAttribute("class","CBJTable_playerStatus");
			this.m_oObjects["container"].appendChild(this.m_oObjects["playerStatus"]);
		}
		if(this.m_oObjects["playerJoinButton"]==null)
		{
			this.m_oObjects["playerJoinButton"]= document.createElement("span");
			this.m_oObjects["playerJoinButton"].setAttribute("id","dTable" + this.id + "_playerJoin");
			this.m_oObjects["playerJoinButton"].setAttribute("class","CBJTable_playerJoin");
			this.m_oObjects["playerJoinButton"].onclick = bind(this, this.playerJoin);
			this.m_oObjects["container"].appendChild(this.m_oObjects["playerJoinButton"]);
		}
		parent.appendChild(this.m_oObjects["container"]);
	}
}